package com.blb.mapper;

import com.blb.entity.Laser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;


import com.blb.entity.Order;
import com.blb.entity.Printer;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-14
 */
public interface LaserMapper extends BaseMapper<Laser> {

    /**
     * 模糊查询
     */
    List<Order> findbyorderid(@Param("start")int start, @Param("length") int length,@Param("orderid") String orderid,@Param("companyId") String companyId);

     int count(@Param("orderid") String orderid, @Param("companyId") String companyId);




    List<Laser> findcode(@Param("start") int start, @Param("length") int length,@Param("lNo") String lNo,@Param("companyId") String companyId);


    int count1(@Param("lNo") String lno,@Param("companyId") String companyId);



    List<Laser> findfp(@Param("start") int start, @Param("length") int length, @Param("nocode")  String nocode, @Param("companyId")  String companyId);


    int count2(@Param("nocode")  String nocode,@Param("companyId")  String companyId);


    List<Printer> findallprinter(@Param("start") int start, @Param("length") int length);

    int count3();


    /**
     * 删除订单
     * @param id
     */
    @Select("delete from t_order where id = #{id}")
     void  delete(String id);


     @Select("SELECT number FROM t_order WHERE id=#{Id}")
     int findnumbyid(String id);

    @Select("insert into t_laser(id,l_no,l_code,l_status,company_id) values(#{id},#{lNo},#{lCode},#{lStatus},#{companyId})")
       void addlaser(Laser laser);

    @Select("select order_id from t_order where id =#{id}")
    String findnobyid(String id);

    @Select("SELECT p.p_num FROM t_order a LEFT JOIN t_production_line pl ON a.product_line_id = pl.id LEFT JOIN t_printer p ON pl.production_name = p.p_line WHERE a.order_id = #{lon}")
    String findnum(String lon);

    @Select("UPDATE t_laser SET l_printer = #{num},l_serial=#{lserial} WHERE l_no =#{lno}")
    void  updatebyno(@Param("num")String num,@Param("lserial") String lserial ,@Param("lno")String lno );




      List<Laser> findbyid(@Param("start") int start, @Param("length") int length, @Param("ids") List<String> ids);

      int count4(@Param("ids") List<String> ids);


      void updateStatus(@Param("ids") List<String> ids);

    /**
     * 根据激光码查询商品信息
     * @param lCode
     * @param companyid
     * @return
     */
    Laser findByCode(String lCode,String companyid);

}
